I've created my own adminhtml grid for a module and was wondering if somebody could point out how I can adjust the width of the whole grid itself? (I.E to only utilize 80% of the page width).
Please note that I am not asking how to change the column width, but the % of the page that the grid's width will occupy.
Thanks in advance.
P.S I've got a feeling it will be in the Grid.php file?
class Namespace_Module_Block_Adminhtml_Custom_Grid extends Mage_Adminhtml_Block_Widget_Grid
public function __construct(){
parent::__construct();
#Somewhere here?
}
1 Answer 1
You can do that from css.
Add to your grid page a custom css file with this line:
#ID_OF_GRID {width:80%}
Use firebug, or view source to see the value for ID_OF_GRID.
Usually the id is the value you set in the grid constructor using:
$this->setId('...');
-
Thanks, excellent solution. Could you please indicate to me what your preferred way of adding custom css? I went the route of <action method="addCSS"> in the layout.xml file of mine.Moose– Moose2013年11月20日 14:51:06 +00:00Commented Nov 20, 2013 at 14:51